#define _CRT_SECURE_NO_DEPRECATE
#define _CRT_NONSTDC_NO_DEPRECATE
#include"StringPool.h"
#include"variable.h"
#include"Feature.h"
#include"stdio.h"
#include"Util.h"
using namespace std;

Feature::Feature(int i, double v){
	value=v;
	index=i;
}

Feature::Feature(){};

Feature::~Feature(){};

Feature Feature::clone(){
	return Feature(index, value);
}

Feature Feature::negation(){
	return Feature(index, -value);
}

string* Feature::toString(){
	char* str=new char[100];
	sprintf(str, "%.8lf", value);
	string* _value = new string(str);
	string* sb = Util::intToString(index);
	sb->append("=" + *_value);
	delete(str);
	delete(_value);
	return sb;
}
